package cn.jingyuan.bee.exception;

public abstract class SystemExceptionUtils {

    public static SystemException newInstance(String code, String codeMsg) {
        return newInstance(code, codeMsg, null, null, null);
    }

    public static SystemException newInstance(String code, String codeMsg, Object[] params) {
        return newInstance(code, codeMsg, params, null, null);
    }

    public static SystemException newInstance(String code, String codeMsg, Object[] params, String detailMessage) {
        return newInstance(code, codeMsg, params, detailMessage, null);
    }

    public static SystemException newInstance(String code, String codeMsg, String detailMessage) {
        return newInstance(code, codeMsg, null, detailMessage, null);
    }

    public static SystemException newInstance(String code, String codeMsg, String detailMessage, Throwable cause) {
        return newInstance(code, codeMsg, null, detailMessage, cause);
    }

    public static SystemException newInstance(String code, String codeMsg, Throwable cause) {
        return newInstance(code, codeMsg, null, null, cause);
    }

    public static SystemException newInstance(ErrorCode code) {
        return newInstance(code, null, null, null);
    }

    public static SystemException newInstance(ErrorCode code, Object[] params) {
        return newInstance(code, params, null, null);
    }

    public static SystemException newInstance(ErrorCode code, Object[] params, String detailMessage) {
        return newInstance(code, params, detailMessage, null);
    }

    public static SystemException newInstance(ErrorCode code, String detailMessage) {
        return newInstance(code, null, detailMessage, null);
    }

    public static SystemException newInstance(ErrorCode code, String detailMessage, Throwable cause) {
        return newInstance(code, null, detailMessage, cause);
    }

    public static SystemException newInstance(ErrorCode code, Throwable cause) {
        return newInstance(code, null, null, cause);
    }

    public static SystemException newInstance(ErrorCode code, Object[] params, String detailMessage, Throwable cause) {
        return newInstance(
            code.getCode(),
            code.getCodeMsg(),
            params,
            detailMessage,
            cause
        );
    }

    public static SystemException newInstance(String code, String codeMsg, Object[] params, String detailMessage, Throwable cause) {
        return new SystemException(code, codeMsg, params, detailMessage, cause);
    }

}
